home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 March
/
EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso
/
internet
/
others
/
cloneclock.lha
/
cloneclock.s
< prev
Wrap
Text File
|
1995-07-28
|
3KB
|
163 lines
*************************************************************
** SLICER's CloneClock
*************************************************************
execbase=4
OpenLib=-408 ;DOS
CloseLib=-414
Output=-60
Write=-48
DateStamp=-192
DateToStr=-744
Execute=-222
Delay=-198
;--------- MAIN
start: move.l a0,argpointer ;we'll need it!!
bsr.w opendos
beq.b .panic
bsr.b writeshit
bsr.b validatearg
bcs.b .stupid ;you didn't read the docs
bsr.b getstamp ;get time and generate structure
beq.b .close
bsr.w cpydateandtime
bsr.w transferclock
bsr.b waiter
bsr.w saveclock
.close bsr.w closeDOS
.panic: rts
.stupid: move.l #param,d2 ;write stuff
move.l #paramend-param,d3
bsr.b writeit
bsr.b .close
rts
;--------- USEFUL CODE
writeshit: move.l dosbase(pc),a6
move.l #comment,d2
move.l #commentend-comment,d3
bsr.b writeit
rts
writeit: JSR -60(A6)
MOVE.L D0,D1
JSR -48(A6) ;Ud med tekst
rts
getstamp: move.l #clockdata,d1
jsr datestamp(a6)
jsr DateToStr(a6)
tst.l d0
rts
validatearg: move.l argpointer(pc),a0
moveq #0,d1
move.b (a0),d1
cmp2.b .range,d1 ;use this instruction if you have 020++
bcs.b .end
; cmp.b .range,d1 ;else use these..
; bcs.b .end
; cmp.b .range+1,d1
; bhi.b .end
andi.b #$0f,d1 ;mask out unwanted bits
move.b d1,argbyte
rts
.end: ori.b #1,ccr ;set carry
rts
.range: dc.b $30,$39
waiter: move.b argbyte(pc),d1
mulu.w #50,d1 ;1 second = 50 tics
jsr delay(a6)
rts
cpydateandtime: lea thedate(pc),a0
lea date(pc),a1
moveq #8,d0
.again: move.b (a0)+,(a1)+ ;copy the date in place
dbra d0,.again
lea thetime(pc),a0
lea time(pc),a1
moveq #7,d0
.again2: move.b (a0)+,(a1)+ ;copy the time to its rightfull place
dbra d0,.again2
rts
transferclock: move.l #netcmd,d1 ;command addr.
bsr.b shootshit
rts
saveclock: move.l #netcmd2,d1 ;2nd command addr.
bsr.b shootshit
rts
shootshit: moveq #0,d2
moveq #0,d3
jsr Execute(a6) ;do it!
tst.l d0 ;success?
rts
;--------- SYSTEM ROUTINES
opendos: move.l (execbase).w,a6
lea dosname(pc),a1
jsr OpenLib(a6)
move.l d0,dosbase
rts
closedos: move.l dosbase(pc),a1
move.l (execbase).w,a6
jsr CloseLib(a6)
rts
;---------- DATA STUFF
dosname: dc.b 'dos.library',0
dosbase: dc.l 0
argpointer: dc.l 0
argbyte: dc.b 0
even
ClockData: dc.w 0 ;UWORD sec
dc.w 0 ;UWORD min
dc.w 0 ;UWORD hour
dc.w 0 ;UWORD mday
dc.w 0 ;UWORD month
dc.w 0 ;UWORD year
dc.b 0 ;dat_Format (dos setting)
dc.b 0 ;dat_Flags (no today/tomorrow etc.)
dc.l 0 ;dat_StrDay -and we need no pointer to that
dc.l thedate ;dat_StrDate
dc.l thetime ;dat_StrTime
thedate: blk.b 16,0
thetime: blk.b 16,0
netcmd: dc.b 'netcmd "date '
date: blk.b 9,0
dc.b ' '
time: blk.b 8,0
dc.b '"',0
netcmd2: dc.b 'netcmd "setclock save"',0
comment: dc.b $9b,"1;3;4;33;40m"
dc.b 'CloneClock by SLICER -1995'
dc.b $9b,"0;31;40m"
dc.b 13,10
commentend:
ver: dc.b '$VER: CloneClock v0.99997',0
param: dc.b 'Cloneclock d',10,13
dc.b 'where d (delay in seconds) is [0-9]',10,13
paramend: